1. Field of Invention
The present invention pertains to the field of computer graphics display systems. More particularly, the present invention relates to an apparatus and method for a high performance multiple layer Z-buffer in a computer graphics display system.
2. Description of Related Art
One area in which computer systems are finding increased application is in that of the graphical arts. Technological advances in the speed, processing power, and memory of computers coupled with lower costs have made them ideally suited for use in graphical display systems. Computer generated displays enable users to visualize two and three dimensional objects. Users can group the information content of a graphical display much more effectively than if the same information were to be presented in other formats. A picture is worth a thousand words.
Furthermore, computer graphics also provide a natural and fluid interaction between the computer and a user. Changes to a display are input to the computer which then effectuates those desired changes by modifying the display accordingly. This process provides a convenient vehicle for modeling, predicting, and experimenting with various events. And with the development of high resolution display screens, increasingly complex geometric objects can be rendered with greater precision and clarity. Some examples of computer graphics applications include flight simulators for training pilots, computer aided design for aiding engineers and architects, diagnostic medical scanners for doctors, animated pictures in movies and video games, etc.
Basically, a computer graphics system can be broken into three components: a frame buffer, a monitor, and a display controller. The frame buffer is a digital memory for storing the image to be displayed as a series of binary values. The monitor is comprised of a screen having an array of picture elements, known as pixels. Each pixel represents a dot on the screen and can be programmed to a particular color or intensity. Thousands of individual pixels so programmed are used to represent a displayed image. It is these individual pixel values which are stored in the frame buffer. A display controller is an interface used for passing the contents of the frame buffer to the monitor. The display controller reads the data from the display buffer and converts it into a video signal. The video signal is fed to the monitor which displays the image.
Images are repeatedly rendered into the display over and over again, with each new frame representing a new position or shape of the image to be viewed. The image must be repeatedly sent to the monitor in order to maintain a steady picture on the screen. Due to the retentiveness of the human eye, the monitor needs to be refreshed at a minimum of 30 times a second. Otherwise, the display will flicker in a very annoying and distracting manner. In today's computer graphics systems, the refresh frequency is typically around 72 hertz (i.e., 72 times a second). A faster refresh rate produces less flicker. Hence, the duration for displaying an image is relatively small, approximately 1/72 of a second or 14 milliseconds. Given these restraints, it is imperative to speed up the graphics drawing process to avoid sluggish response times and jerky movements of displayed images. Moreover, the faster an image can be drawn, the more information which can be provided to the display. This results in smoother, more dynamic, and crisper images.
Typically, a three-dimensional graphics rendering device that renders images into the frame buffer also stores additional information per pixel (e.g., Alpha, Z, etc.), which is not required by the frame buffer itself. Alpha values represent a blending function. Z-values represent a pixel's distance from the viewer. Typically, small Z-values indicate that the object is close to the observer, whereas large Z-values indicate that the object is further away. This additional Z storage per pixel is typically referred to as a Z-buffer.
By implementing a Z-buffer, usually in the form of DRAMs, Z-values can be stored. The Z-buffer contains distance information which is used in indicating whether one object is displayed in front of or behind another object. In most conventional Z-buffers, a Z-sort operation is performed by comparing the Z-value of incoming data with the Z-value of pre-existing data. If the incoming data is closer (i.e., it has a smaller Z-value), the incoming color data replaces the pre-existing data in the frame buffer, and the old Z-value is replaced by the new Z-value. Otherwise, the incoming dam is discarded. When there is no more incoming data, the Z-sort is complete, and the contents of each frame buffer/Z-buffer location represents the final color/intensity for that particular pixel.
The Z-sort operation is rather straightforward if all of the objects represented by the data are opaque. However, if the object in the buffer is not opaque, it is necessary to retain information about the data which is discarded in order to determine the final color intensity of a pixel. To avoid the loss of the data, many Z-buffer systems require that all of the non-opaque data be rendered after all opaque data has been rendered and that the non-opaque data be rendered in Z sorted order (e.g., closest to furthest). Any non-opaque objects which are behind the opaque object in the buffer are discarded. The remaining non-opaque objects are composited with the data in the frame buffer and the result is stored in the frame buffer so that no requisite information is lost. The composite represents a combination of a data from non-opaque objects. For example, if a blue non-opaque object is composited with a red non-opaque object, the resulting composite object may appear mostly blue, mostly red, or purple. Since the compositing operation must be performed in a specific Z order, the non-opaque objects must be arranged by Z-depth (i.e., either closest to furthest or furthest to closest) before being compared with the Z-value of the data in the buffer.
Unfortunately, this method of rendering non-opaque objects has a number of shortcomings. Sorting the non-opaque objects by Z-value is computationally expensive. Also, this method does not render interpenetrating non-opaque objects correctly; these must be explicitly tested for, and specially processed, further increasing computation. Consequently, performing the Z sort process reduces the amount of time left to actually draw the images which detrimentally impacts the overall display process.
Other systems have been proposed to solve the problem of rendering non-opaque objects which avoid these shortcomings. These systems usually store more than one Z and color value per pixel, allowing some number of the closest non-opaque objects to be saved, and then composited later. However, these systems require a greatly increased number of Z-buffer RAM accesses necessary to maintain and sort the multiple Z-values per pixel. This increases the bandwidth requirements of the Z-buffer memory, reducing performance and/or increasing cost. However, an advantage of this method is that it defers compositing until after the per pixel Z sort is complete, which improves performance by avoiding unnecessary compositing of objects which are later obscured by a closer object.
Therefore, there is a need in prior art computer graphics systems for an apparatus or method which is capable of minimizing the time required to perform Z operations. It would be preferable if such an apparatus or method could defer compositing until after Z sort is completed without losing the data necessary for compositing non-opaque objects. It would also be highly preferable if such a mechanism could minimize the number of DRAM accesses.